import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'

Vue.config.productionTip = false
axios.defaults.baseURL = "http://192.168.120.55"
axios.defaults.withCredentials = true
Vue.prototype.$http = axios
Vue.use(ElementUI)
Array.prototype.remove = function(val) { 
var index = this.indexOf(val); 
if (index > -1) { 
this.splice(index, 1); 
} 
};

// 添加响应拦截器
axios.interceptors.response.use(function (response) {
	console.log(response);
	if(response.data.code == 504 ){
		localStorage.removeItem("loginuser");
		router.push("/");
		return;
	}
    // 对响应数据做点什么
    return response;
  }, function (error) {
    // 对响应错误做点什么
    return Promise.reject(error);
  });

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
